package com.example.lenovo.testdemo.utils;

import java.io.File;
import java.io.FileInputStream;

/**
 * Created by Lenovo on 2017/11/21.
 */

public class FileUtil {
    public static long getFilesize(String name){
        long size = 0;
        File file = new File(name);
        FileInputStream fis = null;
        try{
            if (file.exists()) {

                fis = new FileInputStream(file);
                size = fis.available();
            } else {
                file.createNewFile();
            }
        }catch (Exception ex){
            ex.printStackTrace();
        }finally {
            try{
                fis.close();
            }catch (Exception ex){
                ex.printStackTrace();
            }
            return size;
        }


    }
}
